<%@ page language="java" pageEncoding="UTF-8"%>

<%@ page import="java.util.*" %>

<link href="inc/style.css" type=text/css rel=stylesheet>
<link href="inc/dtree/dtree.css" type=text/css rel=stylesheet>
<script language=jscript src="inc/dtree/dtree.js"></script>
<body topmargin="3" leftmargin="6" style="background-color: white;">
<SCRIPT LANGUAGE="JavaScript">
<!-- 
var d;
function getTreeView(xml){
  d = new dTree('d');
  
  if(xml!=''){
	   var xmlDoc = new ActiveXObject('MSXML2.DOMDocument');
       xmlDoc.async = false;
       xmlDoc.loadXML(xml);   
       var xmlRoot = xmlDoc.documentElement;

	   var Flow = xmlRoot.getElementsByTagName("FlowConfig").item(0);	   
	   flowId = Flow.getElementsByTagName("BaseProperties").item(0).getAttribute("flowId");
	   flowText = Flow.getElementsByTagName("BaseProperties").item(0).getAttribute("flowText");

	   d.add(0,-1,' '+flowText+'','javascript:','',flowId,'');
	   d.add(1,0,'Steps','javascript:','','Steps','','inc/dtree/img/obj1.gif','inc/dtree/img/obj2.gif');
	   d.add(2,0,'Actions','javascript:','','Actions','','inc/dtree/img/obj1.gif','inc/dtree/img/obj2.gif');

	   var i = 0,num = 3;
	   
	   var Steps = xmlRoot.getElementsByTagName("Steps").item(0);       
	   var id, text;
	   for (i = 0;i < Steps.childNodes.length;i++) {
		   var Step = Steps.childNodes.item(i);
		   id = Step.getElementsByTagName("BaseProperties").item(0).getAttribute("id");
		   text = Step.getElementsByTagName("BaseProperties").item(0).getAttribute("text");		   
		   d.add(num++,1,text,'javascript:','',id,'','inc/dtree/img/obj4.gif','inc/dtree/img/obj4.gif');
	   }
	   
	   var Actions = xmlRoot.getElementsByTagName("Actions").item(0);
	   for (i = 0;i < Actions.childNodes.length;i++){
		   var Action = Actions.childNodes.item(i);
		   id = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("id");
		   text = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("text");
		   d.add(num++,2,text,'javascript:','',id,'','inc/dtree/img/obj4.gif','inc/dtree/img/obj4.gif');
	   }
  }

  return d;
}
document.write(getTreeView(parent.document.all.FlowXML.value));
//-->
</SCRIPT>
</body>